<?php
include("utils1.php");
if($_SESSION['siteuserId']=="")
{
	header("location:start.php");
}
if($_POST['mode']=="delete_landing_page")
{
	delete_landing_page();
}
else
{
	main_content("main();");
}

function delete_landing_page()
{
 $delete_sql="delete from adspace_landing_page where landingId='".$_POST['landingId']."' ";
 mysql_query($delete_sql);

 $file1='landing_page/landing_'.$_POST['landingId'].'.php';
unlink("$file1");
$GLOBALS['msg']="Landing page deleted successfully.";
main_content("main();");
}
function main()
{
?>

<script language="JavaScript">
function choose_template(argu)
{
//alert(argu);
	if(argu=='Templates')
	{
		document.getElementById('table_box').style.display='';
	}
	else
	{
		document.getElementById('table_box').style.display='none';
	}
}

function delete_landing_page(landingId)
		{
			var FAQResp = window.confirm("Are you sure to remove the selected landing page ?");
			if( FAQResp == true )
			{
				
				document.getElementById('mode').value='delete_landing_page';
				document.getElementById('landingId').value=landingId;
				//add_price
				document.getElementById('landing_page_form').submit();
			}
		}

</script>
<form name="landing_page_form" method="POST" action="" id="landing_page_form">
<input type="hidden" name="mode" id="mode" value="">
<input type="hidden" name="landingId" id="landingId" value="">

<table width="831" class="center" cellspacing="0" cellpadding="0">
  
  <tr>
    <td align="left" valign="top">
    	
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
           <tr>
           <td>
	<table width="830" align="center" border="0" cellspacing="0" cellpadding="0">
	<?php
	if($GLOBALS['msg']!="")
	{
	?>
	<tr>
   	 <td align="center" valign="top" class="drop_downTxt" style="padding-bottom:15px;">
		<?php echo $GLOBALS['msg'];?>
	</td>
  </tr>
	<?php
	}
	?>
  	<tr>
   	 <td align="left" valign="top" class="drop_downTxt">
		Create Landing Page from: 
			<select name="" class="drop_downBox">
		  	<option>--Select--</option>
			<option value="Templates" onclick="return choose_template('Templates');">Templates</option>
			<?php
			$sql_landing_page="select pageName,landingId from adspace_landing_page where UserId='".$_SESSION['siteuserId']."' ";
			$query_landing_page=mysql_query($sql_landing_page);
			while($rec_landing_page=mysql_fetch_array($query_landing_page))
			{
			?>
			<option value="<?php echo $rec_landing_page['landingId'];?>" onclick="return choose_template('<?php echo $rec_landing_page['pageName'];?>');"><?php echo $rec_landing_page['pageName'];?></option>
			<?php
			}
			?>
			</select>
	</td>
  </tr>
  
  <tr>
    <td align="left" valign="top" class="table_box" style="display:none;" id="table_box">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		 <!-- <tr>
			<td align="left" valign="top" class="txtboxTxt">Enter Page Name : <input name="" class="txtbox" type="text" /></td>
		  </tr>-->
		  <tr>
			<td><img src="images/spacer.gif" alt="" height="14" /></td>
		  </tr>
		  <tr>
			<td align="left" valign="top">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tr>
				  	<!-- 1st table box -->
					<td align="left" valign="top" width="138">
						<table width="138" border="0" cellspacing="0" cellpadding="0">
						  <tr>
							<td><img src="images/box_table_ltop.jpg" alt="" /></td>
							<td width="130" class="table_boxTop"></td>
							<td><img src="images/box_table_rtop.jpg" alt="" /></td>
						  </tr>
						  <tr>
							<td class="table_boxLSide"></td>
							<td class="table_boxMidd">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td align="left" class="table_boxHeadingTxt">Click-2-Call</td>
								  </tr>
								  <tr>
									<td align="center"><img src="images/0.gif" alt="" /></td>
								  </tr>
								  <tr>
									<td align="left" valign="top" class="table_boxTxt table_boxHeight">
										Create a page that allows customers to contact you directly via a phone call.
									</td>
								  </tr>
								  <tr>
									<td align="center" class="build"><input name="" type="button" value="Build" onClick="javascript:window.location='click-2-call.php';"  /></td>
								  </tr>
								</table>
							</td>
							<td class="table_boxRSide"></td>
						  </tr>
						  <tr>
							<td><img src="images/box_table_lbot.jpg" alt="" /></td>
							<td width="130" class="table_boxBot"></td>
							<td><img src="images/box_table_rbot.jpg" alt="" /></td>
						  </tr>
						</table>
					</td>
				  	<!-- /1st table box -->					
					<td width="12">&nbsp;</td>
					<!-- 2nd table box -->
					<td align="left" valign="top" width="138">
						<table width="138" border="0" cellspacing="0" cellpadding="0">
						  <tr>
							<td><img src="images/box_table_ltop.jpg" alt="" /></td>
							<td width="130" class="table_boxTop"></td>
							<td><img src="images/box_table_rtop.jpg" alt="" /></td>
						  </tr>
						  <tr>
							<td class="table_boxLSide"></td>
							<td class="table_boxMidd">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td align="left" class="table_boxHeadingTxt">Lead Generation</td>
								  </tr>
								  <tr>
									<td align="center"><img src="images/1.gif" alt="" /></td>
								  </tr>
								  <tr>
									<td align="left" valign="top" class="table_boxTxt table_boxHeight">
										Create a page on which customers can enter email address or phone number.
									</td>
								  </tr>
								  <tr>
									<td align="center" class="build"><input name="" type="submit" value="Build"  /></td>
								  </tr>
								</table>
							</td>
							<td class="table_boxRSide"></td>
						  </tr>
						  <tr>
							<td><img src="images/box_table_lbot.jpg" alt="" /></td>
							<td width="130" class="table_boxBot"></td>
							<td><img src="images/box_table_rbot.jpg" alt="" /></td>
						  </tr>
						</table>
					</td>
				  	<!-- /2nd table box -->		
					<td width="12">&nbsp;</td>
					<!-- 3rd table box -->
					<td align="left" valign="top" width="138">
						<table width="138" border="0" cellspacing="0" cellpadding="0">
						  <tr>
							<td><img src="images/box_table_ltop.jpg" alt="" /></td>
							<td width="130" class="table_boxTop"></td>
							<td><img src="images/box_table_rtop.jpg" alt="" /></td>
						  </tr>
						  <tr>
							<td class="table_boxLSide"></td>
							<td class="table_boxMidd">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td align="left" class="table_boxHeadingTxt">Mobile Flyer</td>
								  </tr>
								  <tr>
									<td align="center"><img src="images/2.gif" alt="" /></td>
								  </tr>
								  <tr>
									<td align="left" valign="top" class="table_boxTxt table_boxHeight">
										Create a page that explains your product or service.
									</td>
								  </tr>
								  <tr>
									<td align="center" class="build"><input name="" type="submit" value="Build"  /></td>
								  </tr>
								</table>
							</td>
							<td class="table_boxRSide"></td>
						  </tr>
						  <tr>
							<td><img src="images/box_table_lbot.jpg" alt="" /></td>
							<td width="130" class="table_boxBot"></td>
							<td><img src="images/box_table_rbot.jpg" alt="" /></td>
						  </tr>
						</table>
					</td>
				  	<!-- /3rd table box -->		
					<td width="12">&nbsp;</td>
					<!-- 4th table box -->
					<td align="left" valign="top" width="138">
						<table width="138" border="0" cellspacing="0" cellpadding="0">
						  <tr>
							<td><img src="images/box_table_ltop.jpg" alt="" /></td>
							<td width="130" class="table_boxTop"></td>
							<td><img src="images/box_table_rtop.jpg" alt="" /></td>
						  </tr>
						  <tr>
							<td class="table_boxLSide"></td>
							<td class="table_boxMidd">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td align="left" class="table_boxHeadingTxt">RSS Feed</td>
								  </tr>
								  <tr>
									<td align="center"><img src="images/3.gif" alt="" /></td>
								  </tr>
								  <tr>
									<td align="left" valign="top" class="table_boxTxt table_boxHeight">
										Create a page that pulls content from an RSS feed.
									</td>
								  </tr>
								  <tr>
									<td align="center" class="build"><input name="" type="submit" value="Build"  /></td>
								  </tr>
								</table>
							</td>
							<td class="table_boxRSide"></td>
						  </tr>
						  <tr>
							<td><img src="images/box_table_lbot.jpg" alt="" /></td>
							<td width="130" class="table_boxBot"></td>
							<td><img src="images/box_table_rbot.jpg" alt="" /></td>
						  </tr>
						</table>
					</td>
				  	<!-- /4th table box -->		
					<td width="12">&nbsp;</td>
					<!-- 5th table box -->
					<td align="left" valign="top" width="138">
						<table width="138" border="0" cellspacing="0" cellpadding="0">
						  <tr>
							<td><img src="images/box_table_ltop.jpg" alt="" /></td>
							<td width="130" class="table_boxTop"></td>
							<td><img src="images/box_table_rtop.jpg" alt="" /></td>
						  </tr>
						  <tr>
							<td class="table_boxLSide"></td>
							<td class="table_boxMidd">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
								  <tr>
									<td align="left" class="table_boxHeadingTxt">Custom</td>
								  </tr>
								  <tr>
									<td align="center"><img src="images/-1.gif" alt="" /></td>
								  </tr>
								  <tr>
									<td align="left" valign="top" class="table_boxTxt table_boxHeight">
										Create a custom page with any number of modules.
									</td>
								  </tr>
								  <tr>
									<td align="center" class="build"><input name="" type="submit" value="Build"  /></td>
								  </tr>
								</table>
							</td>
							<td class="table_boxRSide"></td>
						  </tr>
						  <tr>
							<td><img src="images/box_table_lbot.jpg" alt="" /></td>
							<td width="130" class="table_boxBot"></td>
							<td><img src="images/box_table_rbot.jpg" alt="" /></td>
						  </tr>
						</table>
					</td>
				  	<!-- /5th table box -->		
				  </tr>
				</table>
			</td>
		  </tr>
		</table>
	</td>
  </tr>  
</table>
		  </td>
          </tr>

		<tr><TD>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
		<td class="txtboxTxt">
			Landing Pages
		</td>
		</tr>
		</table>	
		</TD></tr>

		<tr><TD style="padding-top:20px;">

		<table width="100%" cellspacing="1" cellpadding="0" border="1">
 <TR>
  <TD align="center">

<table width="100%" class="login_txt" cellspacing="1" cellpadding="0" border="0">
	<tr>
		<td class="listHeader" align="center">Name</td>
        <td class="listHeader" align="center">Type</td>
        <td class="listHeader" align="center">Created on</td>
		 <td class="listHeader" align="center">Delete</td>
        
	</tr>
    
	<?php
	$sql_landing_page_list="select * from adspace_landing_page where UserId='".$_SESSION['siteuserId']."' ";
	$query_landing_page_list=mysql_query($sql_landing_page_list);
	$num_landing_page_list=mysql_num_rows($query_landing_page_list);
	if($num_landing_page_list>0)
	{
	$loop=0;
	while($rec_landing_page_list=mysql_fetch_array($query_landing_page_list))
		{
		$loop++;
		if($loop%2 == 0) 
		{
		$class1="normalActive2";
		$class2="normal2";
		$class3="normal2";
		$class4="gray_sitename2";
		}
		else 
		{
		$class1="normalActive";
		$class2="normal";
		$class3="normal";
		$class4="white_sitename2";
		}	
	
	?>
    <tr onmouseover="this.className='<?php echo $class1;?>'" onmouseout="this.className='<?php echo $class2;?>'" class="<?php echo $class3;?>">
        <td class="<?php echo $class4;?>" align="center">
		<a href="click-2-call.php?id=<?php echo $rec_landing_page_list['landingId'];?>"><?php echo $rec_landing_page_list['pageName'];?></a>&nbsp;
		</td>
       
        <td class="<?php echo $class4;?>" align="center"><?php echo $rec_landing_page_list['type'];?>&nbsp;</td>

        <td class="<?php echo $class4;?>" align="center">

<?php echo date("j F, Y",strtotime($rec_landing_page_list[created_date]));?>&nbsp;
</td>
        <td class="<?php echo $class4;?>" align='center' style="padding-right: 10px">
			<span onclick="return delete_landing_page(<?php echo $rec_landing_page_list['landingId'];?>);">
			<img alt="Delete" src="/r/images/delete.gif?1235597648" />
			</span>&nbsp;
		</td>
    </tr>

	<?php
		}// end while
		}// end if
		else
		{
	?>
		<tr>
		<td align="center" colspan="4" height="30" class="<?php echo $class4;?>"> No records found </td>
	</tr>
		<?php
		} // end else
		?>
</table>
</TD>
</tr>

</table>
</TD>
</tr>

</table>

</td>
</tr>
</table>

</form>


<?php
}
?>